class Solution:
    def canMeasureWater(self, x: int, y: int, z: int) -> bool:
        if x>y:
            x,y= y,x
        if x+y<z:
            return False
        b = 2
        a = -1*y
        while b> a:
            t = abs(b*y-z)
            if x==0 and t==0 or x!=0 and t%x == 0:
                print(b)
                return True
            else:
                b-=1
        return False


if __name__ == '__main__':
    so = Solution()
    x = 22003
    y = 31237
    z = 1
    r = so.canMeasureWater(x,y,z)
    print(r)
